home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 9233 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.6 KB

  1. Path: newshost.lanl.gov!tanmoy
  2. From: tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya)
  3. Newsgroups: comp.unix.programmer,comp.lang.c
  4. Subject: Re: Runtime ANSI C checking tool?
  5. Date: 08 Mar 1996 01:05:01 GMT
  6. Organization: Los Alamos National Laboratory
  7. Message-ID: <TANMOY.96Mar7180501@qcd.lanl.gov>
  8. References: <DnI89B.EnH@pgh.nauticom.net> <p5ag239ede.fsf@lemming.wellfleet.com>
  9.     <826219697snz@genesis.demon.co.uk>
  10. NNTP-Posting-Host: qcd.lanl.gov
  11. Mime-Version: 1.0
  12. Content-Type: text
  13. In-reply-to: Lawrence Kirby's message of Thu, 07 Mar 96 17:28:17 GMT
  14.  
  15. In article <826219697snz@genesis.demon.co.uk>
  16. Lawrence Kirby <fred@genesis.demon.co.uk> writes:
  17.  
  18. LK: >Well, a well-written ANSI C compiler should handle all language
  19. LK: >violations, and a well-written ANSI C system library should catch all
  20. LK: >runtime violations (passing NULL to strcpy() or something, for
  21. LK: >example).
  22. LK: 
  23. LK: Not possible in general (at least for the compiler or the standard library)
  24. LK: e.g.
  25. LK: 
  26. LK: int foo(int *p, int *q)
  27. LK: {
  28. LK:     return ++*p + ++*q;
  29. LK: }
  30. LK: 
  31. LK: This results in undefined behaviour if the same value is passed for p and
  32. LK: q.
  33.  
  34. Well, it is possible for the compiler to put in a runtime check :-)
  35.  
  36. Cheers
  37. Tanmoy
  38. --
  39. tanmoy@qcd.lanl.gov(128.165.23.46) DECNET: BETA::"tanmoy@lanl.gov"(1.218=1242)
  40. Tanmoy Bhattacharya O:T-8(MS B285)LANL,NM87545 H:#9,3000,Trinity Drive,NM87544
  41. Others see <gopher://yaleinfo.yale.edu:7700/00/Internet-People/internet-mail>,
  42. <http://alpha.acast.nova.edu/cgi-bin/inmgq.pl>or<ftp://csd4.csd.uwm.edu/pub/
  43. internetwork-mail-guide>. -- <http://nqcd.lanl.gov/people/tanmoy/tanmoy.html>
  44. fax: 1 (505) 665 3003   voice: 1 (505) 665 4733    [ Home: 1 (505) 662 5596 ]
  45.